//
//  JSBaseDataService.h
//  NiubilityProject
//
//  Created by Apple on 2018/3/6.
//  Copyright © 2018年 Apple. All rights reserved.
//

#import <Foundation/Foundation.h>
@class JSBaseDataService;
@protocol JSBaseDataServiceDelegate <NSObject>

/*!
 数据更新回调
 
 数据
 */
@required
-(void)dataServiceDidUpdate:(JSBaseDataService *)service data:(id)data error:(NSError *)error;
-(NSString *)dataServiceUrlSting;
-(NSMutableDictionary *)dataServiceParameter;
@optional
-(void)overHeaderRefrensh; // 结束下拉刷新

/*!
 结束上拉加载更多
 
 isResstingData : 是否重置数据
 */
-(void)overFooterRefrensh:(BOOL)isResstingData; 
-(NSInteger)dataServicePageNumber;
@end

@interface JSBaseDataService : NSObject
/** 数据源*/
@property (nonatomic, strong) NSMutableArray *dataSource;
/** 页 */
@property (nonatomic, assign) NSInteger page;
/** 方法名 必传 */
//@property (nonatomic, strong) NSString *method;
/** 方法名 必传 */
@property (nonatomic, strong) NSString *urlString;
/** 参数 */
@property (nonatomic, strong) NSMutableDictionary *params;
/** 每页默认条数 */
@property (nonatomic, assign) NSInteger pageNumber;
/** 每页默认条数 */
@property (nonatomic, weak) id<JSBaseDataServiceDelegate> delegate;

//-(instancetype)initWithUrlString:(NSString *)urlstring parameter:(NSDictionary *)params pageNumber:(NSInteger)pageNumber;

// 重新请求数据
-(void)refrenshData;
// 请求下一页数据
-(void)nextData;

@end
